/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package employeepayrollsystem;

import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.*;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author DON IS ON
 */
public class db {
    
   
    
    public static void main(String a[])
    {
        
    }
    
  
             public  static void executeupdate(String q)
    {
      String host="jdbc:mysql://localhost:3306/";
        String dbname="student";
        String username="root";
        String password="";
        String url=host+dbname+"?user="+username+"&password="+password;
        try{
           
            Class.forName("com.mysql.jdbc.Driver");
            Connection con=DriverManager.getConnection(url);
            Statement st=con.createStatement();
            int a=st.executeUpdate(q);
             
            //st.executeUpdate(q);
            
            
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }
     
    }
     
     public static ResultSet exexutequery(String q)
     {
        String host="jdbc:mysql://localhost:3306/";
        String dbname="student";
        String username="root";
        String password="";
        String url=host+dbname+"?user="+username+"&password="+password;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection con=DriverManager.getConnection(url);
            Statement st=con.createStatement();
            ResultSet rs=st.executeQuery(q);
            return rs;
            
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
            return null;
        }
        
     }
     
    
}
